#ifndef __EPSILON_3D__TGA_H__
#define __EPSILON_3D__TGA_H__

typedef struct tagTARGAFILEHEADER
{
  unsigned char imageIDLength;      // Number of characters in identification field;
                                    // 0 denotes no identification field

  unsigned char colorMapType;       // Type of color map;
  unsigned char imageTypeCode;      // Uncompressed RGB       == 2
                                    // Uncompressed Greyscale == 3

  short int     colorMapOrigin;     // Origin of color map
  short int     colorMapLength;     // Length of color map
  short int     colorMapEntrySize;  // Color map entry size

  short int     imageXOrigin;       // X coordinate of lower-left corner of image
  short int     imageYOrigin;       // Y coordinate of lower-left corner of image

  short int     imageWidth;         // Width of image in pixels
  short int     imageHeight;        // Height of pimage in pixels

  unsigned char bitCount;           // Number of bits; 16, 24, 32
  unsigned char imageDescriptor;    // 24 bit == 0x00; 32-bit == 0x08
} TARGAFILEHEADER;


typedef struct   /* 8 Bytes */
{
  unsigned char  imageTypeCode;     /* 000 */
  short int      imageWidth;        /* 001 */
  short int      imageHeight;       /* 003 */
  unsigned char  bitCount;          /* 005 */
  unsigned char  numChannels;       /* 006 */
  unsigned char* imageData;         /* 007 */
} TGAFILE;

class eFile;

bool e3dLoadTGA     (eFile& file, TGAFILE* tgaFile);
bool l3dSaveTGAFile ( const char*          filename,
                      const short int&     width,
                      const short int&     height,
                      const unsigned char& bits,
                      unsigned char* imageData );

#endif /* __EPSILON_3D__TGA_H__ */


